package cdu.javaendwork.Controller.Admin.AdoptionMore;

import cdu.javaendwork.model.sqlModel.Pet;
import cdu.javaendwork.service.Impl.AdoptionMore.PetServiceImpl;
import cdu.javaendwork.service.Interface.AdoptionMore.PetService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/admin/pet_show")
public class PetShowController extends HttpServlet {

    PetService petService=new PetServiceImpl();

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // 根据id获取用户
        String pid=req.getParameter("petid");
        int petid = Integer.parseInt(pid);
        Pet pet=petService.findById(petid);
        req.setAttribute("pet",pet);

        // 跳转到修改管理员的界面
        req.getRequestDispatcher("pet_show.jsp").forward(req,resp);
    }


}
